/*
 * @Author: xitontong
 * @Date: 2020-03-09 11:42:59
 * @LastEditTime: 2020-04-30 15:00:48
 * @LastEditors: xitontong
 * @Description: 
 */
#include "NFComm/NFPluginModule/NFIPluginManager.h"
#include "NFComm/NFPluginModule/NFIFishGameMain.h"
#include "NFComm/NFPluginModule/NFISceneModule.h"
#include "NFComm/NFPluginModule/NFIElementModule.h"
#include "NFComm/NFPluginModule/NFIKernelModule.h"
#include "NFComm/NFPluginModule/NFIScheduleModule.h"
#include "NFComm/NFPluginModule/NFIGameServerNet_ServerModule.h"
#include "NFComm/NFPluginModule/NFINetModule.h"
#include "NFComm/NFPluginModule/NFILogModule.h"
#include "NFComm/NFPluginModule/NFIPropertyModule.h"
#include <string>
#include <random>
#include "Dependencies/ajson/ajson.hpp"
#ifndef NF_H_FISH_GAME_MODULE
#define NF_H_FISH_GAME_MODULE
class FishGameMain:public NFIFishGameMain{
public:
    FishGameMain(NFIPluginManager * p){
        pPluginManager = p;
    }
    virtual ~FishGameMain(){

    }
    bool Init();
    virtual bool AfterInit();
private:
    int BeforeEnterSceneGroup(const NFGUID&, const int, const int, const int, const NFDataList&);
    int AfterLeaveSceneGroup(const NFGUID&, const int, const int, const int, const NFDataList&);
    int AfterEnterAndSceneRead(const NFGUID & self, const int nSceneID, const int nGroupID, const int nType, const NFDataList & argList);
    std::string GetSceneGroupScheduleName(const int nSceneId,const int nGroupId);
    int SceneGroupScheduler(const NFGUID&,const std::string&, const float, const int);
    //添加网络消息监听
    void AddNetMsgListener();
    //启 / 停桌子计时
    void StartTableClock(int nSceneId,int nGroupId);
    void StopTableClock(int nSceneId,int nGroupId);
    void groupLogic(int nSceneId,int nGroupId);
    void processGroups(int nSceneId,int nGroupId,NF_SHARE_PTR<NFIRecord> fishGroups);
    void SetValidSeatId(const int nSceneID, const int nGroupID,const NFGUID & self);
    void OnReqUseSkill(const NFSOCK sockIndex, const int msgID, const char* msg, const uint32_t len);
    void OnReqCatchCheck(const NFSOCK sockIndex, const int msgID, const char* msg, const uint32_t len);
    int OnObjectClassEvent( const NFGUID& self, const std::string& className, const CLASS_OBJECT_EVENT classEvent, const NFDataList& var );
    int OnObjectKillerEvent( const NFGUID& self, const std::string& propertyName, const NFData& oldVar, const NFData& newVar);
private:
    NFISceneModule * m_pSceneModule;
    NFIElementModule * m_pElementModule;
    NFIKernelModule * m_pKernelModule;
    NFIScheduleModule * m_pScheduleModule;
    NFIClassModule * m_pClassModule;
    NFIGameServerNet_ServerModule* m_pGameServerNet_ServerModule;
    NFINetModule *m_pNetModule;
    NFILogModule * m_pLogModule;
    NFIPropertyModule * m_pPropertyModule;
    map<string,vector<int>> usedSeatId;

};
#endif